<script setup>

import { computed, ref } from 'vue';
import Header from '../../components/Header.vue';
import titles from '../../components/titles.vue'
import { useRouter } from 'vue-router';


let Name = ref('张三')
let NameInPinyin = ref('')
let IDNumber = ref('300102199511251111')
let DateOfBirth = ref('Nov. 23. 1995')
let ValidPeriod = ref('2016/12/31-2026/12/31')
let router = useRouter()

let canSubmit = computed(()=>{
    return  Name.value.trim() !== '' &&
            NameInPinyin.value.trim() !== '' &&
            IDNumber.value.trim() !== '' &&
            DateOfBirth.value.trim() !== '' &&
            ValidPeriod.value.trim() !== '' ;
})

let handleSubmit = () =>{
    router.push('/chineseIDs')
}

</script>



<template>
    <Header></Header>
    <div class="content">
        <titles :title="'Apply Credentials / Chinese ID'"></titles>
        <div class="box">
            <div class="left-box">
                <div>
                    <p>
                        <RouterLink to="/MyCredentials">My Credentials</RouterLink>
                    </p>
                </div>
                <div class="left-box-active">
                    <p>
                        <RouterLink to="/ApplyCredentials">Apply Credentials</RouterLink>
                    </p>
                </div>
                <div>
                    <p>
                        <RouterLink to="/AccountInformation">Account Information</RouterLink>
                    </p>
                </div>
            </div>
            <div class="right-box">
                <div class="right-box-title">
                    <p class="title">Confirm Chinese ID</p>
                </div>

                <div class="right-box-input">
                    <div class="right-box-input-box">
                        <div class="right-box-input-box-left">Name<span>*</span></div>
                        <input class="right-box-input-box-right" type="text" placeholder="Enter Name" v-model="Name" />
                    </div>
                    <div class="right-box-title-zhuyi" v-if="!Name">Please input Name!</div>
                    <div class="right-box-input-box">
                        <div class="right-box-input-box-left">Name in Pinyin<span>*</span></div>
                        <input class="right-box-input-box-right" type="text" placeholder="ZHANG SAN" v-model="NameInPinyin" />
                    </div>
                    <div class="right-box-title-zhuyi" v-if="!NameInPinyin">Please input Name in Pinyin!</div>
                    <div class="right-box-input-box">
                        <div class="right-box-input-box-left">ID Number<span>*</span></div>
                        <input class="right-box-input-box-right" type="text" value="300102199511251111" v-model="IDNumber" />
                    </div>
                    <div class="right-box-title-zhuyi" v-if="!IDNumber">Please input ID Number!</div>
                    <div class="right-box-input-box">
                        <div class="right-box-input-box-left">Date of Birth<span>*</span></div>
                        <input class="right-box-input-box-right" type="text" value="Nov. 23. 1995" v-model="DateOfBirth" />
                    </div>
                    <div class="right-box-title-zhuyi" v-if="!DateOfBirth">Please input Date of Birth!</div>
                    <div class="right-box-input-box">
                        <div class="right-box-input-box-left">Valid Period<span>*</span></div>
                        <input class="right-box-input-box-right" type="text" value="2016/12/31-2026/12/31" v-model="ValidPeriod" />
                    </div>
                    <div class="right-box-title-zhuyi" v-if="!ValidPeriod">Please input Valid Period!</div>
                </div>

                <div class="right-box-bottom">
                    <button :disabled="!canSubmit" :class="{ 'btn_grey': canSubmit }" @click="handleSubmit" 
                                type="submit">Next</button>
                    <!-- <button class="btn_grey">
                        <RouterLink to="/chineseIDs">Next</RouterLink>
                    </button> -->
                </div>
            </div>
        </div>
    </div>
</template>
<style scoped>
.content {
    width: 1100px;
    height: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    margin-top: 100px;

    .title {
        display: flex;
        color: #1F2930;
        font-size: 20px;
        font-weight: 600;
        line-height: 30px;

        p {
            margin: 0 10px 20px 0;
        }

        .title-home {
            color: #0F094C;
        }
    }

    .box {
        display: flex;

        .left-box {
            display: flex;
            flex-direction: column;
            border: 1px solid #EFEFEF;
            width: 271px;
            margin: 0 20px 0 0;

            .left-box-active {
                p {
                    color: #EC535B;
                    font-weight: 700;
                    font-size: 18px;
                }

                background-color: #FFECEC;
            }

            p {
                margin: 20px 0 20px 10px;
                color: #1F2930;
                font-size: 18px;
                font-weight: 400;
            }
        }

        .right-box {
            border: 1px solid #EFEFEF;
            width: 900px;

            .right-box-title {
                margin: 20px;

            }

            .right-box-input {
                .right-box-title-zhuyi {
                    color: #EC535B;
                    font-size: 14px;
                    margin-left: 20px;
                }
                .right-box-input-box {
                    border: 1px solid #EFEFEF;
                    width: 474px;
                    height: 44px;
                    border-radius: 6px;
                    margin: 20px;
                    display: flex;
                    align-items: center;

                    input {
                        width: 200px;
                        height: 30px;
                        font-size: 14px;
                        border: none;
                        outline: none;
                        background-color: rgba(0, 0, 0, 0);

                    }

                    .right-box-input-box-left {
                        margin-left: 20px;
                        font-size: 16px;
                        width: 200px;
                        color: #9A9A9A;
                        span {
                                color: red;
                            }
                    }

                    .right-box-input-box-right {
                        font-size: 14px;
                    }
                }
            }

            .right-box-bottom {
                display: flex;
                justify-content: end;

                button {
                    width: 149px;
                    height: 44px;
                    margin: 200px 50px 0 0;
                    border-radius: 6px;
                    border: none;
                    cursor: pointer;
                }
            }

        }


    }
}
</style>